<!-- AUTHORS: Yiwei (Alan) Han, Kevin Lam -->

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<script language="JavaScript" type="text/javascript"
	src="/js/ajax_feeds.js"></script>
	
<link rel="stylesheet" type="text/css" media="all"
	href="/style/feed.css" />
</head>
<%
	String feed_cookie_name = "user";
	Cookie feed_cookies[] = request.getCookies();
	Cookie feed_cookie = null;
	if (feed_cookies != null) {
		for (int i = 0; i < feed_cookies.length; i++) {
			if (feed_cookies[i].getName().equals(feed_cookie_name)) {
				feed_cookie = feed_cookies[i];
				break;
			}
		}
	}
	String feed = "";
	if (feed_cookie != null) {
		feed = "<script>ajaxUpdate();</script><div id='feed-content'>";
		feed += "	<div class='feed_header'>Feeds</div>";
		feed += "<div id='feed-menu'>";
		feed += "<div id='post-button' class='feed-menu-button' onmouseover='document.getElementById(\"post-button\").className=\"feed-menu-button-mouseover\"' onmouseout='document.getElementById(\"post-button\").className=\"feed-menu-button\"' onclick='postShow();'>";
		feed += "<img src='/images/pencil-icon.png'>";
		feed += "</div>";
		feed += "<div id='friend-button' class='feed-menu-button' onmouseover='document.getElementById(\"friend-button\").className=\"feed-menu-button-mouseover\"' onmouseout='document.getElementById(\"friend-button\").className=\"feed-menu-button\"' onclick='friendShow();'>";
		feed += "<img src='/images/friend-icon.png'>";
		feed += "</div>";
		feed += "</div>";
		feed += "<div id='feeds'></div>";
		feed += "</div>";
		feed += "<div id='post-dialog'>";
		feed += "<p id='post-header'>Write a new post:</p>";
		feed += "<p id='post-area-container'><textarea id='post-area' onkeypressed='postKeyPressed(event)' rows='10' columns='30' resizeable='false'></textarea></p>";
		feed += "<div id='post-submit' class='post-submit' onmouseover='document.getElementById(\"post-submit\").className=\"post-submit-mouseover\"' onmouseout='document.getElementById(\"post-submit\").className=\"post-submit\"' onclick='tryPost()'>Post</div>";
		feed += "</div>";
		feed += "<div id='friend-dialog'>";
		feed += "<p id='friend-header'>Pending Friend Requests</p>";
		feed += "<div id='friend-pending'></div>";
		feed += "<p id='friend-header'>Friends <span class='addFriend' onclick='addFriendShow()'>+</span></p>";
		feed += "<div id='friend-list'></div>";
		feed += "</div>";
		feed += "<div id='add-friend-dialog'>";
		feed += "<p>Please enter your friend's email address</p>";
		feed += "<input type='text' size='40' id='friend-email' />";
		feed += "<input type='submit' value='Add' onclick='addFriend()'>";
		feed += "<input type='button' value='Close' onclick='addFriendClose()'>";
		feed += "</div>";
		feed += "<div id='post-error' class='post-error_red'>";
		feed += "</div>";
		feed += "<div id='friend-error'></div>";
		feed += "<div id='feed-dimmer'></div>";
		feed += "</body>";
		out.println(feed);
	}
%>
</html>